package Action;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import Dao.noticedao;
import Entity.Notice;
import Entity.User;
import mapper.Noticemapper;

/**
 * Servlet implementation class Notice2Servlet
 */
@WebServlet("/Notice2Servlet")
public class Notice2Servlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Notice2Servlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		System.out.println("ddd");
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("user");
		String id =user.getUid();
		Noticemapper nm = new noticedao();
		Notice notices= nm.queryByNid(id);
		nm.setRead(notices.getNotice_Id());
		request.setAttribute("notices2",notices);
		System.out.println(notices);
		request.getRequestDispatcher("m_link_detail.jsp").forward(request,response);
	}

}
